import request from '@/utils/request'

// 新增部门
export function addDept(data) {
  return request({
    url: '/system/dept',
    method: 'post',
    data: data
  })
}


// 查询车辆位置信息
export function tbLocationTrainList(query) {
  return request({
    url: '/work/TbLocationTrain/getTrackList',
    method: 'get',
    params: query
  })
}
// 获取救援设备信息
export function getWorkEquList(query) {
  return request({
    url: '/work/equ/getByCarNo',
    method: 'get',
    params: query
  })
}




// 查询车辆位置信息
export function TbEquTrainList(query) {
  return request({
    url: '/work/TbEquTrain/list',
    method: 'get',
    params: query
  })
}

// 获取任务信息
export function getWorkOrderList(query) {
  return request({
    url: '/work/TbWorkOrder/list',
    method: 'get',
    params: {
      status: 1,
      ...query
    }
  })
}

// 获取任务人员信息
export function getWorkOrderUserByWorkNo(workNo) {
  return request({
    url: '/work/TbWorkOrderUser/getByWorkNo',
    method: 'get',
    params: { workNo }
  })
}
// 获取任务人员信息
export function getTbWorkOrderUserList(query) {
  return request({
    url: '/work/TbWorkOrderUser/list',
      method: 'get',
     params: query
  
  })
}
// 定时器获取人员位置信息
export function getLocationQuertz(query) {
  return request({
    url: '/work/TbWorkOrder/getLocationQuertz',
      method: 'get',
     params: query
  
  })
}

// 获取人员位置轨迹信息
// export function getLocationUserByUserWork(userNo, workNo) {
//   return request({
//     url: '/work/TbLocationUser/getByUserWork',
//     method: 'get',
//     params: { userNo, workNo }
//   }).then(response => {
//     // 正常请求接口，但使用 person.json 的数据替换返回
//     return import('@/const/person.json').then(module => {
//       const personData = module.default || module
//       // 根据 workNo 过滤数据
//       const filteredData = personData.filter(item => item.workNo === workNo)

//       return {
//         ...response,
//         code: 200,
//         msg: '查询成功',
//         data: filteredData
//       }
//     })
//   })
// }
export function getLocationUserByUserWork(userNo, workNo) {
  return request({
    url: '/work/TbLocationUser/getByUserWork',
    method: 'get',
    params: { userNo, workNo }
  })
}
